class BootStrap {

    def init = {servletContext ->
        def dp = new Clique(name: 'Dining Philosophers', description: "Think, drink, eat with chopsticks")
        def p = new Person(firstName: 'Sonny', lastName: 'To', email: "son@kaicode.com")
        dp.addToMembers(p)
        dp.addToForums(new Forum(name: 'General', description: "General Talk"))

        def chengdu = new Clique(name: 'Chengdu Dining Philosophers', description: 'Dining Philosophers in Chengdu, China')
        chengdu.addToMembers(p)
        chengdu.addToForums(new Forum(name: 'Groovy', description: "Groovy Talk"))
        dp.addToSubGroups(chengdu)

        def shanghai = new Clique(name: 'Shanghai Dining Philosophers', description: 'Dining Philosophers in Shanghai, China')
        shanghai.addToMembers(p)
        shanghai.addToForums(new Forum(name: 'Linux', description: 'SHLUG. Linux Users Group'))
        shanghai.addToEvents(new Event(name: 'Groovy/grails', place: 'Flying Elephant', startTime: new Date()))

        dp.addToSubGroups(shanghai)
        dp.save()
    }

    def destroy = {
    }
} 